<?php
//use think\Route;
use think\facade\Route;
//Route::get('play/:gid', 'index/game/index');

//index
Route::group('game', function() {
    Route::get('play/:gid', 'index/game/index');//游戏地址  cp
    Route::get('play/:gid/:cid', 'index/game/index');//游戏地址 渠道 分发
    Route::post('index', 'index/index/index');//登录、支付、个人中心、修改密码、忘记密码弹窗
    Route::post('sendSms', 'index/login/sendSms');//发送短信
    Route::post('phoneLogin', 'index/login/phoneLogin');//手机号登录
    Route::post('login', 'index/login/login');//账号登录
    Route::post('wxLogin', 'index/login/wxLogin');// 微信登录
    Route::post('register', 'index/login/register');//账号注册
    Route::post('forgetPassword', 'index/player/forgetPassword');//忘记密码
    Route::post('changePassword', 'index/player/changePassword');//修改密码
    Route::post('logout', 'index/login/logout');//退出登录
    Route::post('create_order', 'index/pay/create_order');//创建订单
    Route::post('pay', 'index/pay/pay');//支付
    Route::get('pay/result/query/:gid/:order_no', 'index/pay/pay_query');//支付结果查询
    Route::post('order/query', 'index/pay/order_query');//订单查询
    Route::post('createRole', 'index/player/createRole');//上传游戏角色
    Route::get('getPlayer', 'index/player/getPlayer');//获取玩家信息
    Route::post('uploadLoginTime', 'index/player/updatePlayerLoginTime');//登录信息更新
    Route::post('send_order', 'index/player/send_order');//发送订单数据
    Route::post('uploadImg', 'api/Upload/uploadImg');//上传图片
    Route::post('submitReport', 'index/player/submitReport');//客服中心提交
    Route::post('sendPlayerMsg', 'index/Message/sendPlayerMsg');//发送玩家消息
    Route::get('getPlayerMsg', 'index/Message/getPlayerMsg');//获取玩家消息
    Route::get('getWxConfig', 'index/Index/getWxConfig');//获取微信配置
    Route::get('getWxLogin', 'index/Index/getWxLogin');// 微信登录openid
    Route::post('playerAuth', 'index/player/playerAuth');// 实名认证

});

// faxing
Route::group('aiqiH5', function() {
    Route::get('play/:gid/:cid', 'faxing/game/index');//游戏地址 渠道 分发
    Route::post('login', 'faxing/game/register');//登录注册
    Route::post('order', 'faxing/pay/pay');//下单
    Route::post('create_role', 'faxing/game/create_role');// 渠道发送角色信息
    Route::get('register/:gid/:cid', 'faxing/game/getGameUrl');//登录注册
    Route::get('role/:gid/:cid', 'faxing/game/getRole');//查询角色接口
});

//admin
Route::group('admin', function() {
    //导出
    Route::get('export', 'admin/ExportExcel/exportExcel');
    Route::get('export_settle/:cp_id/:date_month/:type', 'admin/ExportExcel/export_settle'); // 导出结算单
    Route::post('uploadImg', 'api/Upload/uploadImg');//上传图片

    Route::get('/', 'admin/index/index');//后台首页
    Route::get('index', 'admin/login/index'); //管理后台登录页
    Route::post('login', 'admin/login/login');// 登录
    Route::get('home', 'admin/index/index');//后台首页
    Route::post('clear', 'admin/system/clear');//清楚缓存
    Route::get('changePassword', 'admin/ChangePassword/index');//修改密码
    Route::post('updatePassword', 'admin/ChangePassword/updatePassword');//更新密码
    Route::get('logout', 'admin/login/logout');//退出登录

    Route::get('gameRank', 'admin/index/gameRank');//后台首页


    // 菜单
    Route::resource('menu', 'admin/menu');//菜单list
    Route::get('menu/add', 'admin/menu/add');//添加
    Route::get('menu/add/:pid', 'admin/menu/add');//添加
    Route::post('menu/save', 'admin/menu/save');//保存
    Route::get('menu/delete', 'admin/menu/delete');//删除
    Route::post('menu/update', 'admin/menu/update');//更新

    // 订单
    Route::get('order', 'admin/order/index');//订单list
    Route::get('supply', 'admin/game/supply');//补单list
    Route::post('order/handleorder', 'admin/player/handleorder');//补单

    // 玩家
    Route::get('player', 'admin/player/logininfo');
    Route::post('player/check', 'admin/player/check');
    Route::get('llog', 'admin/player/llog');
    Route::get('role', 'admin/PlayerRole/index');
    Route::get('jinling', 'admin/player/jinling');
    Route::get('jingling_del/:id', 'admin/player/jingling_del');
    Route::get('player/auth', 'admin/player/auth'); // 查询玩家实名认证信息

    // 管理员
    Route::resource('user', 'admin/AdminUser');
    Route::get('user/add', 'admin/AdminUser/add');
    Route::post('user/save', 'admin/AdminUser/save');
    Route::get('user/edit/:id', 'admin/AdminUser/edit');
    Route::get('user/delete', 'admin/AdminUser/delete');
    Route::post('user/update', 'admin/AdminUser/update');

    // 权限组
    Route::resource('auth', 'admin/AuthGroup');
    Route::get('auth/add', 'admin/AuthGroup/add');
    Route::post('auth/save', 'admin/AuthGroup/save');
    Route::get('auth/edit/:id', 'admin/AuthGroup/edit');
    Route::get('auth/delete', 'admin/AuthGroup/delete');
    Route::post('auth/update/:id', 'admin/AuthGroup/update');
    Route::get('auth/auth/:id', 'admin/AuthGroup/auth');
    Route::post('auth/getJson', 'admin/AuthGroup/getJson');
    Route::post('auth/updateAuthGroupRule', 'admin/AuthGroup/updateAuthGroupRule');

    // 配置管理
    Route::get('config', 'admin/config/index');
    Route::get('config/getinfo', 'admin/config/getinfo');
    Route::get('config/add', 'admin/config/add');

    // 渠道游戏管理
    Route::get('agent', 'admin/GameAgent/index');
    Route::get('agent/add', 'admin/GameAgent/add');
    Route::get('agent/edit/:id', 'admin/GameAgent/edit');
    Route::post('agent/update/:id', 'admin/GameAgent/update');
    Route::post('agent/save', 'admin/GameAgent/save');
    Route::get('agent/extData/:id', 'admin/GameAgent/extData');
    Route::post('agent/saveData/:id', 'admin/GameAgent/saveData');

    Route::get('gaode_agent', 'admin/GameAgent/gaode');
    Route::get('gaode_agent/add', 'admin/GameAgent/gaode_add');
    Route::get('gaode_agent/edit/:id', 'admin/GameAgent/gaode_edit');
    Route::post('gaode_agent/update/:id', 'admin/GameAgent/gaode_update');
    Route::post('gaode_agent/save', 'admin/GameAgent/gaode_save');

    // 游戏管理
    Route::get('game', 'admin/game/index');
    Route::get('game/add', 'admin/game/add');
    Route::post('game/save', 'admin/game/save');
    Route::get('game/edit/:id', 'admin/game/edit');
    Route::post('game/update', 'admin/game/update');
    Route::get('game/delete/:id', 'admin/game/delete');
    Route::post('game/check', 'admin/game/check');

    // CP管理
    Route::get('cpgame', 'admin/CpGame/index');
    Route::get('cpgame/add', 'admin/CpGame/add');
    Route::post('cpgame/save', 'admin/CpGame/save');
    Route::get('cpgame/edit/:id', 'admin/CpGame/edit');
    Route::post('cpgame/update', 'admin/CpGame/update');
    Route::get('cpgame/delete/:id', 'admin/CpGame/delete');

    // 渠道管理
    Route::get('channel', 'admin/Channel/index');
    Route::get('channel/add', 'admin/Channel/add');
    Route::get('channel/edit/:id', 'admin/Channel/edit');
    Route::post('channel/update', 'admin/Channel/update');
    Route::post('channel/save', 'admin/Channel/save');
    Route::get('channel/delete/:id', 'admin/Channel/delete');

    // 修改状态
    Route::get('checkstatus', 'admin/checkstatus/index');

    // 客服中心
    Route::get('message', 'admin/Message/index');
    Route::get('message/edit/:id', 'admin/message/edit');
    Route::post('message/reply', 'admin/message/reply');
    Route::post('message/close/:id', 'admin/message/close');

    // 数据统计
    Route::get('recharge', 'admin/stat/recharge');
    Route::get('recharge/days', 'admin/stat/days');
//    Route::get('recharge/games', 'admin/stat/games');
    Route::get('recharge/months', 'admin/stat/months');

    //游戏按照游戏统计
    Route::get('game_stat/day', 'admin/stat/game_stat_day');// 每个游戏渠道统计 天
    Route::get('game_stat/months', 'admin/stat/game_stat_months');// 每个游戏渠道统计 月

    // 高德数据统计
    Route::get('gaode', 'admin/stat/gaode');
    Route::get('gaode/days', 'admin/stat/gaode_days');
    Route::get('gaode/months', 'admin/stat/gaode_months');

    // 财务数据统计
    Route::get('finance', 'admin/finance/months');
    Route::get('settle/index', 'admin/settle/index');// 结算账单
    Route::get('settle/detail/:cp_id/:date_month/:type', 'admin/Settle/detail');// 游戏结算详情
    Route::get('settle/yulan/:cp_id/:date_month/:type', 'admin/Settle/yulan');// 游戏结算预览
    Route::post('settle/settle', 'admin/settle/settle');// 结算账单
    Route::get('settle/gaode', 'admin/settle/gaode');// 高德结算

    // 公告管理
    Route::get('adv', 'admin/article/index');
    Route::get('adv/add', 'admin/article/add');
    Route::get('adv/edit/:id', 'admin/Article/edit');
    Route::get('adv/delete/:id', 'admin/Article/delete');
    Route::post('adv/delete', 'admin/Article/delete');
    Route::post('adv/save', 'admin/Article/save');//保存
    Route::post('adv/update/:id', 'admin/Article/update');
    Route::post('adv/check', 'admin/Article/check');

});

//api
Route::group('v1', function() {
    Route::group('api',function() {
        Route::post('notify/pay/alipay', 'api/notify/alipay_notify');//微信回调
        Route::post('notify/pay/weixin', 'api/notify/wechat_notify');
        Route::post('notify/game_pay_notify', 'api/GameNotify/game_notift_test');//游戏订单回调test
        Route::post('notify/game/pay_notify/:gid/:cid', 'api/ChannelGameNotify/notify');// 渠道支付回调
        Route::get('notify/game/pay_notify/:gid/:cid', 'api/ChannelGameNotify/notify');// 渠道支付回调
        Route::post('userCertify', 'api/UserAuth/auth');//实名认证
        Route::post('userCertify/:cid', 'api/UserAuth/auth');//实名认证
        Route::post('playerReport', 'api/UserAuth/reportLogInOut');//数据上报
        Route::get('ueditor/index', 'api/Ueditor/index');//数据上报
    });
});

Route::group('channel', function() {
    Route::get('/', 'channel/stat/index');//默认数据统计
//    Route::get('/', 'channel/index/index');//后台首页
    Route::get('index', 'channel/index/index');//后台首页
    Route::get('login', 'channel/login/index');// 登录页面
    Route::post('login', 'channel/login/login');// 登录
    Route::get('logout', 'channel/login/logout'); // 退出登录
    Route::get('change_password', 'channel/ChangePassword/index');// 修改密码
    Route::get('stat/index', 'channel/stat/index');// 数据统计
    Route::get('stat/days', 'channel/stat/days');// 数据统计
    Route::get('order/index', 'channel/order/index');// 订单列表

    //导出
    Route::get('export', 'channel/ExportExcel/exportExcel');
});